package top.psjj.ssm.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import top.psjj.ssm.entity.User;

import java.util.List;

@Repository
public interface UserMapper {
    boolean insertUser(User user);

    @Select("select * from t_user where username = #{username} and password = #{password}")
    User login(User user);

    @Select("select * from t_user where id = #{id}")
    User selectById(Integer id);

    @Update("update t_user set truename = #{truename},username=#{username} where id = #{id}")
    Integer updateById(User user);

    @Delete("delete from t_user where id = #{id}")
    Integer deleteById(Integer id);

    @Select("select * from t_user")
    List<User> list();

    @Select("select * from t_user where username = #{username}")
    User selectByUsername(User user);

}
